package com.wfcm.wxUitls;

import com.alibaba.fastjson.JSONObject;
import com.wfcm.utils.NetUtil;

import java.util.ArrayList;
import java.util.List;

public class SendMessage {

    public static void main(String[] args) {
        String tplId = "LFJ0TpYaaQO_VfjCcQZa66nQnIVBwgCYgYKRBw52Ucc";
        Template tem=new Template();
        tem.setTemplateId(tplId);
        tem.setTopColor("#333");

        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("first","您有一笔新订单，等待发货。","#333"));
        paras.add(new TemplateParam("keyword1","T16081000152","#333"));
        paras.add(new TemplateParam("keyword2","白菜套餐*1","#333"));
        paras.add(new TemplateParam("keyword3","9.00元","#333"));
        paras.add(new TemplateParam("keyword4","余额支付","#333"));
        paras.add(new TemplateParam("keyword5","零零壹、12345678901","#333"));
        paras.add(new TemplateParam("remark","请及时处理,感谢你对云农批的支持!!!","#333"));

        tem.setTemplateParamList(paras);
        tem.setToUser("openid");//用户openid
        //设置超链接
       // tem.setUrl(WeixinConfig.getInstance().getYnp_url());

        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
        JSONObject jsonObject = null;//sendTemplateMsg(tem);
    }


    /*public static JSONObject  sendTemplateMsg(Template template){

        //获取token
        String token = accessTokenService.getAccessToken();

        String requestUrl = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN";

        requestUrl=requestUrl.replace("ACCESS_TOKEN", token);

        *//*if (log.isDebugEnabled()) {
            log.debug(template.toJSON());
        }*//*
        //发送模板消息,返回json格式结果
        JSONObject jsonObject = CommonUtil.httpsRequestToJsonObject(requestUrl, "POST", template.toJSON(),false);

        return jsonObject;


    }*/



}
